<%--  This file is part of LitSearch.

    LitSearch is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    LitSearch is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with LitSearch; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA --%>

<jsp:useBean id="languageObj" class="de.fhbrs.litsearch.LanguageBean" scope="session" />
<jsp:useBean id="userObj" class="de.fhbrs.litsearch.UserBean" scope="session" />
<jsp:useBean id="settingsObj" class="de.fhbrs.litsearch.SettingsBean" scope="session" />

<%
  if (userObj.isLoggedIn() || !settingsObj.isInIpRange(request.getRemoteAddr())) {
    if (userObj.isPublisher()) {
%>
      <jsp:forward page="index.jsp?content=admin" />
<%
    }
    else {
%>
    <jsp:forward page="index.jsp?content=search" />
<%
    }
  }
%>

<%= languageObj.getTextFor("login.notice") %><br /><br />
<% if (userObj.loginIsIncorrect()) out.print("<p class=\"red\">"+languageObj.getTextFor("login.incorrect")+"</p>"); %>
<form method="post" name="loginForm" action="index.jsp?content=login">	
  <table id="login">
    <tr>
      <td><b><%= languageObj.getTextFor("login.username") %>:</b></td>
      <td><input class="right" type="text" name="username" alt="<%= languageObj.getTextFor("login.username") %>" /></td>
    </tr>
    <tr>
      <td><b><%= languageObj.getTextFor("login.password") %>:</b></td>
      <td><input class="right" type="password" name="password" alt="<%= languageObj.getTextFor("login.password") %>" /></td>
    </tr>
    <tr>
      <td></td>
      <td><input class="right" type="submit" name="login" alt="<%= languageObj.getTextFor("login.submit") %>" value="<%= languageObj.getTextFor("login.submit") %>" /></td>
    </tr>
  </table>
</form>
<script type="text/javascript">
/* <![CDATA[ */
 document.loginForm.username.focus();
 document.loginForm.username.select();
/* ]]> */
</script>